package congen.utils;

import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider;
import org.eclipse.xtext.naming.QualifiedName;

import ConnectorGenerator.CommunicationStyle.CommunicationStyle;
import ConnectorGenerator.CommunicationStyle.Role;
import ConnectorGenerator.DRD.Component;
import ConnectorGenerator.DRD.Interface;

public class DRDLQualifiedNameProvider extends
		DefaultDeclarativeQualifiedNameProvider {

	QualifiedName qualifiedName(Interface i) {
		return getConverter().toQualifiedName(((Component) i.eContainer()).getName() + "." + i.getName()); 
	}

	/**
	 * Returns name of the role only. 
	 * Roles are referred just using their name,
	 * without CommunicationStyle name (compared to Interfaces which are
	 * referred including the name of the associated Component)
	 * 
	 * @param r
	 * @return
	 */
	QualifiedName qualifiedName(Role  r) {
		return getConverter().toQualifiedName(r.getName()); 
	}
}
